import { Methods } from "./router";
import { Rendering as Index } from "./src/index";
import { Rendering as Topic } from "./src/topic";
import { Rendering as Find } from "./src/find";
import { Rendering as Information } from "./src/information";

//单击导航栏
let nav = document.querySelectorAll(".head-nav a"),
    selectNav = nav[0];

nav.forEach((value,index,array)=>{
    value.onclick = ()=>{
        if(selectNav){
            selectNav.style.background = "#0661bd";
        }
        value.style.background = "#061dbd";
        selectNav = value;
    }
});

let methods = new Methods();
methods.map("/index",function () {methods.asyncFun(Index)});
methods.map("/topic",function () {methods.asyncFun(Topic)});
methods.map("/find",function () {methods.asyncFun(Find)});
methods.map("/information",function () {methods.asyncFun(Information)});
methods.init();